<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="登记号" prop="registerNumber">
        <el-input
          v-model="queryParams.registerNumber"
          placeholder="请输入登记号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="机构名称" prop="institutionName">
        <el-input
          v-model="queryParams.institutionName"
          placeholder="请输入机构名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="第二名称" prop="secondName">
        <el-input
          v-model="queryParams.secondName"
          placeholder="请输入第二名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="辖区" prop="region">
        <el-input
          v-model="queryParams.region"
          placeholder="请输入辖区"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否校验" prop="check">
        <el-input
          v-model="queryParams.check"
          placeholder="请输入是否校验"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="下一校验日期" prop="nextCheckDate">
        <el-date-picker clearable size="small"
          v-model="queryParams.nextCheckDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择下一校验日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="到期时间" prop="lincenseEnd">
        <el-date-picker clearable size="small"
          v-model="queryParams.lincenseEnd"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择到期时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="医疗机构执业许可证" prop="medicalLicense">
        <el-input
          v-model="queryParams.medicalLicense"
          placeholder="请输入医疗机构执业许可证"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="医疗机构执业许可证" prop="updateTimes">
        <el-date-picker clearable size="small"
          v-model="queryParams.updateTimes"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择医疗机构执业许可证">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="营业状态：0- 正常 1-关闭 2-注销 3-暂停营业 4-文档标红" prop="busStatus">
        <el-select v-model="queryParams.busStatus" placeholder="请选择营业状态：0- 正常 1-关闭 2-注销 3-暂停营业 4-文档标红" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="机构唯一编码" prop="minkeMedicalId">
        <el-input
          v-model="queryParams.minkeMedicalId"
          placeholder="请输入机构唯一编码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="临时状态" prop="temp">
        <el-input
          v-model="queryParams.temp"
          placeholder="请输入临时状态"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="机构级别" prop="medicalLevel">
        <el-input
          v-model="queryParams.medicalLevel"
          placeholder="请输入机构级别"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="机构类别" prop="medicalCategory">
        <el-input
          v-model="queryParams.medicalCategory"
          placeholder="请输入机构类别"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="机构等次" prop="medicalRankname">
        <el-input
          v-model="queryParams.medicalRankname"
          placeholder="请输入机构等次"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="经营性质" prop="medicalNaturebusiness">
        <el-input
          v-model="queryParams.medicalNaturebusiness"
          placeholder="请输入经营性质"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="隶属关系" prop="medicalRelationship">
        <el-input
          v-model="queryParams.medicalRelationship"
          placeholder="请输入隶属关系"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="法定代表人" prop="medicalLegalrepresentative">
        <el-input
          v-model="queryParams.medicalLegalrepresentative"
          placeholder="请输入法定代表人"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="主要负责人" prop="medicalChargerepresentative">
        <el-input
          v-model="queryParams.medicalChargerepresentative"
          placeholder="请输入主要负责人"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="法人证件号" prop="medicalLegalIdCard">
        <el-input
          v-model="queryParams.medicalLegalIdCard"
          placeholder="请输入法人证件号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="负责人证件号" prop="medicalChargeIdCard">
        <el-input
          v-model="queryParams.medicalChargeIdCard"
          placeholder="请输入负责人证件号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="法人年龄" prop="medicalLegalAge">
        <el-input
          v-model="queryParams.medicalLegalAge"
          placeholder="请输入法人年龄"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="负责人年龄" prop="medicalChargeAge">
        <el-input
          v-model="queryParams.medicalChargeAge"
          placeholder="请输入负责人年龄"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="所有制形式" prop="medicalOwnership">
        <el-input
          v-model="queryParams.medicalOwnership"
          placeholder="请输入所有制形式"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="注册资金" prop="medicalMoneyregistered">
        <el-input
          v-model="queryParams.medicalMoneyregistered"
          placeholder="请输入注册资金"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="固定资金" prop="medicalMoneyfix">
        <el-input
          v-model="queryParams.medicalMoneyfix"
          placeholder="请输入固定资金"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="流动资金" prop="medicalMoneyflow">
        <el-input
          v-model="queryParams.medicalMoneyflow"
          placeholder="请输入流动资金"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="服务对象" prop="medicalServiceObject">
        <el-input
          v-model="queryParams.medicalServiceObject"
          placeholder="请输入服务对象"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="服务方式" prop="medicalServiceType">
        <el-select v-model="queryParams.medicalServiceType" placeholder="请选择服务方式" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="业务用床面积" prop="medicalAreabusi">
        <el-input
          v-model="queryParams.medicalAreabusi"
          placeholder="请输入业务用床面积"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="床位数" prop="medicalBedAmout">
        <el-input
          v-model="queryParams.medicalBedAmout"
          placeholder="请输入床位数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="牙椅数" prop="medicalToothChair">
        <el-input
          v-model="queryParams.medicalToothChair"
          placeholder="请输入牙椅数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="机构地址" prop="medicalAddress">
        <el-input
          v-model="queryParams.medicalAddress"
          placeholder="请输入机构地址"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="邮编" prop="medicalPostCode">
        <el-input
          v-model="queryParams.medicalPostCode"
          placeholder="请输入邮编"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="诊疗科目编码" prop="medicalSpecialtiesCode">
        <el-input
          v-model="queryParams.medicalSpecialtiesCode"
          placeholder="请输入诊疗科目编码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="辖区名称" prop="medicalAreaname">
        <el-input
          v-model="queryParams.medicalAreaname"
          placeholder="请输入辖区名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="发证机关" prop="medicalOrganName">
        <el-input
          v-model="queryParams.medicalOrganName"
          placeholder="请输入发证机关"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="发证日期" prop="medicalPassDate">
        <el-input
          v-model="queryParams.medicalPassDate"
          placeholder="请输入发证日期"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="有效开始日期" prop="medicalBeginDate">
        <el-input
          v-model="queryParams.medicalBeginDate"
          placeholder="请输入有效开始日期"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="有效结束日期" prop="medicalEndDate">
        <el-input
          v-model="queryParams.medicalEndDate"
          placeholder="请输入有效结束日期"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="主管单位名称" prop="medicalAdminunitName">
        <el-input
          v-model="queryParams.medicalAdminunitName"
          placeholder="请输入主管单位名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="电话" prop="medicalTelnum">
        <el-input
          v-model="queryParams.medicalTelnum"
          placeholder="请输入电话"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否设置互联网医院 0-否 1-是" prop="medicalInternetType">
        <el-select v-model="queryParams.medicalInternetType" placeholder="请选择是否设置互联网医院 0-否 1-是" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="互联网形式" prop="medicalHospitalType">
        <el-select v-model="queryParams.medicalHospitalType" placeholder="请选择互联网形式" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="第三方合作机构名称" prop="medicalPartnerName">
        <el-input
          v-model="queryParams.medicalPartnerName"
          placeholder="请输入第三方合作机构名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="第三方机构依托的实体医疗机构" prop="medicalPartnerunitName">
        <el-input
          v-model="queryParams.medicalPartnerunitName"
          placeholder="请输入第三方机构依托的实体医疗机构"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合作开始时间" prop="medicalPvbdate">
        <el-input
          v-model="queryParams.medicalPvbdate"
          placeholder="请输入合作开始时间"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合作结束时间" prop="medicalPvedate">
        <el-input
          v-model="queryParams.medicalPvedate"
          placeholder="请输入合作结束时间"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="街道" prop="medicalStreet">
        <el-input
          v-model="queryParams.medicalStreet"
          placeholder="请输入街道"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="申请日期" prop="medicalApplyDate">
        <el-input
          v-model="queryParams.medicalApplyDate"
          placeholder="请输入申请日期"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="开业日期" prop="medicalOpenDate">
        <el-input
          v-model="queryParams.medicalOpenDate"
          placeholder="请输入开业日期"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="批准文号" prop="medicalPassCode">
        <el-input
          v-model="queryParams.medicalPassCode"
          placeholder="请输入批准文号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="统一社会信用代码" prop="medicalUscc">
        <el-input
          v-model="queryParams.medicalUscc"
          placeholder="请输入统一社会信用代码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="状态" prop="medicalBusitype">
        <el-select v-model="queryParams.medicalBusitype" placeholder="请选择状态" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:nation:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:nation:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:nation:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['system:nation:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="nationList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="国家机构唯一识别码" align="center" prop="uniqueCode" />
      <el-table-column label="登记号" align="center" prop="registerNumber" />
      <el-table-column label="机构名称" align="center" prop="institutionName" />
      <el-table-column label="第二名称" align="center" prop="secondName" />
      <el-table-column label="辖区" align="center" prop="region" />
      <el-table-column label="是否校验" align="center" prop="check" />
      <el-table-column label="下一校验日期" align="center" prop="nextCheckDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.nextCheckDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="到期时间" align="center" prop="lincenseEnd" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lincenseEnd, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="医疗机构执业许可证" align="center" prop="medicalLicense" />
      <el-table-column label="医疗机构执业许可证" align="center" prop="updateTimes" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTimes, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="营业状态：0- 正常 1-关闭 2-注销 3-暂停营业 4-文档标红" align="center" prop="busStatus" />
      <el-table-column label="机构唯一编码" align="center" prop="minkeMedicalId" />
      <el-table-column label="临时状态" align="center" prop="temp" />
      <el-table-column label="机构级别" align="center" prop="medicalLevel" />
      <el-table-column label="机构类别" align="center" prop="medicalCategory" />
      <el-table-column label="机构等次" align="center" prop="medicalRankname" />
      <el-table-column label="经营性质" align="center" prop="medicalNaturebusiness" />
      <el-table-column label="隶属关系" align="center" prop="medicalRelationship" />
      <el-table-column label="法定代表人" align="center" prop="medicalLegalrepresentative" />
      <el-table-column label="主要负责人" align="center" prop="medicalChargerepresentative" />
      <el-table-column label="法人证件号" align="center" prop="medicalLegalIdCard" />
      <el-table-column label="负责人证件号" align="center" prop="medicalChargeIdCard" />
      <el-table-column label="法人年龄" align="center" prop="medicalLegalAge" />
      <el-table-column label="负责人年龄" align="center" prop="medicalChargeAge" />
      <el-table-column label="所有制形式" align="center" prop="medicalOwnership" />
      <el-table-column label="注册资金" align="center" prop="medicalMoneyregistered" />
      <el-table-column label="固定资金" align="center" prop="medicalMoneyfix" />
      <el-table-column label="流动资金" align="center" prop="medicalMoneyflow" />
      <el-table-column label="服务对象" align="center" prop="medicalServiceObject" />
      <el-table-column label="服务方式" align="center" prop="medicalServiceType" />
      <el-table-column label="业务用床面积" align="center" prop="medicalAreabusi" />
      <el-table-column label="床位数" align="center" prop="medicalBedAmout" />
      <el-table-column label="牙椅数" align="center" prop="medicalToothChair" />
      <el-table-column label="机构地址" align="center" prop="medicalAddress" />
      <el-table-column label="邮编" align="center" prop="medicalPostCode" />
      <el-table-column label="诊疗科目编码" align="center" prop="medicalSpecialtiesCode" />
      <el-table-column label="诊疗科目名称" align="center" prop="medicalSpecialtiesName" />
      <el-table-column label="辖区名称" align="center" prop="medicalAreaname" />
      <el-table-column label="发证机关" align="center" prop="medicalOrganName" />
      <el-table-column label="发证日期" align="center" prop="medicalPassDate" />
      <el-table-column label="有效开始日期" align="center" prop="medicalBeginDate" />
      <el-table-column label="有效结束日期" align="center" prop="medicalEndDate" />
      <el-table-column label="主管单位名称" align="center" prop="medicalAdminunitName" />
      <el-table-column label="电话" align="center" prop="medicalTelnum" />
      <el-table-column label="是否设置互联网医院 0-否 1-是" align="center" prop="medicalInternetType" />
      <el-table-column label="互联网形式" align="center" prop="medicalHospitalType" />
      <el-table-column label="第三方合作机构名称" align="center" prop="medicalPartnerName" />
      <el-table-column label="第三方机构依托的实体医疗机构" align="center" prop="medicalPartnerunitName" />
      <el-table-column label="合作开始时间" align="center" prop="medicalPvbdate" />
      <el-table-column label="合作结束时间" align="center" prop="medicalPvedate" />
      <el-table-column label="街道" align="center" prop="medicalStreet" />
      <el-table-column label="申请日期" align="center" prop="medicalApplyDate" />
      <el-table-column label="开业日期" align="center" prop="medicalOpenDate" />
      <el-table-column label="批准文号" align="center" prop="medicalPassCode" />
      <el-table-column label="统一社会信用代码" align="center" prop="medicalUscc" />
      <el-table-column label="状态" align="center" prop="medicalBusitype" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:nation:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:nation:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改国家机构对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="登记号" prop="registerNumber">
          <el-input v-model="form.registerNumber" placeholder="请输入登记号" />
        </el-form-item>
        <el-form-item label="机构名称" prop="institutionName">
          <el-input v-model="form.institutionName" placeholder="请输入机构名称" />
        </el-form-item>
        <el-form-item label="第二名称" prop="secondName">
          <el-input v-model="form.secondName" placeholder="请输入第二名称" />
        </el-form-item>
        <el-form-item label="辖区" prop="region">
          <el-input v-model="form.region" placeholder="请输入辖区" />
        </el-form-item>
        <el-form-item label="是否校验" prop="check">
          <el-input v-model="form.check" placeholder="请输入是否校验" />
        </el-form-item>
        <el-form-item label="下一校验日期" prop="nextCheckDate">
          <el-date-picker clearable size="small"
            v-model="form.nextCheckDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择下一校验日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="到期时间" prop="lincenseEnd">
          <el-date-picker clearable size="small"
            v-model="form.lincenseEnd"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择到期时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="医疗机构执业许可证" prop="medicalLicense">
          <el-input v-model="form.medicalLicense" placeholder="请输入医疗机构执业许可证" />
        </el-form-item>
        <el-form-item label="医疗机构执业许可证" prop="updateTimes">
          <el-date-picker clearable size="small"
            v-model="form.updateTimes"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择医疗机构执业许可证">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="营业状态：0- 正常 1-关闭 2-注销 3-暂停营业 4-文档标红">
          <el-radio-group v-model="form.busStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="机构唯一编码" prop="minkeMedicalId">
          <el-input v-model="form.minkeMedicalId" placeholder="请输入机构唯一编码" />
        </el-form-item>
        <el-form-item label="临时状态" prop="temp">
          <el-input v-model="form.temp" placeholder="请输入临时状态" />
        </el-form-item>
        <el-form-item label="机构级别" prop="medicalLevel">
          <el-input v-model="form.medicalLevel" placeholder="请输入机构级别" />
        </el-form-item>
        <el-form-item label="机构类别" prop="medicalCategory">
          <el-input v-model="form.medicalCategory" placeholder="请输入机构类别" />
        </el-form-item>
        <el-form-item label="机构等次" prop="medicalRankname">
          <el-input v-model="form.medicalRankname" placeholder="请输入机构等次" />
        </el-form-item>
        <el-form-item label="经营性质" prop="medicalNaturebusiness">
          <el-input v-model="form.medicalNaturebusiness" placeholder="请输入经营性质" />
        </el-form-item>
        <el-form-item label="隶属关系" prop="medicalRelationship">
          <el-input v-model="form.medicalRelationship" placeholder="请输入隶属关系" />
        </el-form-item>
        <el-form-item label="法定代表人" prop="medicalLegalrepresentative">
          <el-input v-model="form.medicalLegalrepresentative" placeholder="请输入法定代表人" />
        </el-form-item>
        <el-form-item label="主要负责人" prop="medicalChargerepresentative">
          <el-input v-model="form.medicalChargerepresentative" placeholder="请输入主要负责人" />
        </el-form-item>
        <el-form-item label="法人证件号" prop="medicalLegalIdCard">
          <el-input v-model="form.medicalLegalIdCard" placeholder="请输入法人证件号" />
        </el-form-item>
        <el-form-item label="负责人证件号" prop="medicalChargeIdCard">
          <el-input v-model="form.medicalChargeIdCard" placeholder="请输入负责人证件号" />
        </el-form-item>
        <el-form-item label="法人年龄" prop="medicalLegalAge">
          <el-input v-model="form.medicalLegalAge" placeholder="请输入法人年龄" />
        </el-form-item>
        <el-form-item label="负责人年龄" prop="medicalChargeAge">
          <el-input v-model="form.medicalChargeAge" placeholder="请输入负责人年龄" />
        </el-form-item>
        <el-form-item label="所有制形式" prop="medicalOwnership">
          <el-input v-model="form.medicalOwnership" placeholder="请输入所有制形式" />
        </el-form-item>
        <el-form-item label="注册资金" prop="medicalMoneyregistered">
          <el-input v-model="form.medicalMoneyregistered" placeholder="请输入注册资金" />
        </el-form-item>
        <el-form-item label="固定资金" prop="medicalMoneyfix">
          <el-input v-model="form.medicalMoneyfix" placeholder="请输入固定资金" />
        </el-form-item>
        <el-form-item label="流动资金" prop="medicalMoneyflow">
          <el-input v-model="form.medicalMoneyflow" placeholder="请输入流动资金" />
        </el-form-item>
        <el-form-item label="服务对象" prop="medicalServiceObject">
          <el-input v-model="form.medicalServiceObject" placeholder="请输入服务对象" />
        </el-form-item>
        <el-form-item label="服务方式" prop="medicalServiceType">
          <el-select v-model="form.medicalServiceType" placeholder="请选择服务方式">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="业务用床面积" prop="medicalAreabusi">
          <el-input v-model="form.medicalAreabusi" placeholder="请输入业务用床面积" />
        </el-form-item>
        <el-form-item label="床位数" prop="medicalBedAmout">
          <el-input v-model="form.medicalBedAmout" placeholder="请输入床位数" />
        </el-form-item>
        <el-form-item label="牙椅数" prop="medicalToothChair">
          <el-input v-model="form.medicalToothChair" placeholder="请输入牙椅数" />
        </el-form-item>
        <el-form-item label="机构地址" prop="medicalAddress">
          <el-input v-model="form.medicalAddress" placeholder="请输入机构地址" />
        </el-form-item>
        <el-form-item label="邮编" prop="medicalPostCode">
          <el-input v-model="form.medicalPostCode" placeholder="请输入邮编" />
        </el-form-item>
        <el-form-item label="诊疗科目编码" prop="medicalSpecialtiesCode">
          <el-input v-model="form.medicalSpecialtiesCode" placeholder="请输入诊疗科目编码" />
        </el-form-item>
        <el-form-item label="诊疗科目名称" prop="medicalSpecialtiesName">
          <el-input v-model="form.medicalSpecialtiesName" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="辖区名称" prop="medicalAreaname">
          <el-input v-model="form.medicalAreaname" placeholder="请输入辖区名称" />
        </el-form-item>
        <el-form-item label="发证机关" prop="medicalOrganName">
          <el-input v-model="form.medicalOrganName" placeholder="请输入发证机关" />
        </el-form-item>
        <el-form-item label="发证日期" prop="medicalPassDate">
          <el-input v-model="form.medicalPassDate" placeholder="请输入发证日期" />
        </el-form-item>
        <el-form-item label="有效开始日期" prop="medicalBeginDate">
          <el-input v-model="form.medicalBeginDate" placeholder="请输入有效开始日期" />
        </el-form-item>
        <el-form-item label="有效结束日期" prop="medicalEndDate">
          <el-input v-model="form.medicalEndDate" placeholder="请输入有效结束日期" />
        </el-form-item>
        <el-form-item label="主管单位名称" prop="medicalAdminunitName">
          <el-input v-model="form.medicalAdminunitName" placeholder="请输入主管单位名称" />
        </el-form-item>
        <el-form-item label="电话" prop="medicalTelnum">
          <el-input v-model="form.medicalTelnum" placeholder="请输入电话" />
        </el-form-item>
        <el-form-item label="是否设置互联网医院 0-否 1-是" prop="medicalInternetType">
          <el-select v-model="form.medicalInternetType" placeholder="请选择是否设置互联网医院 0-否 1-是">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="互联网形式" prop="medicalHospitalType">
          <el-select v-model="form.medicalHospitalType" placeholder="请选择互联网形式">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
        <el-form-item label="第三方合作机构名称" prop="medicalPartnerName">
          <el-input v-model="form.medicalPartnerName" placeholder="请输入第三方合作机构名称" />
        </el-form-item>
        <el-form-item label="第三方机构依托的实体医疗机构" prop="medicalPartnerunitName">
          <el-input v-model="form.medicalPartnerunitName" placeholder="请输入第三方机构依托的实体医疗机构" />
        </el-form-item>
        <el-form-item label="合作开始时间" prop="medicalPvbdate">
          <el-input v-model="form.medicalPvbdate" placeholder="请输入合作开始时间" />
        </el-form-item>
        <el-form-item label="合作结束时间" prop="medicalPvedate">
          <el-input v-model="form.medicalPvedate" placeholder="请输入合作结束时间" />
        </el-form-item>
        <el-form-item label="街道" prop="medicalStreet">
          <el-input v-model="form.medicalStreet" placeholder="请输入街道" />
        </el-form-item>
        <el-form-item label="申请日期" prop="medicalApplyDate">
          <el-input v-model="form.medicalApplyDate" placeholder="请输入申请日期" />
        </el-form-item>
        <el-form-item label="开业日期" prop="medicalOpenDate">
          <el-input v-model="form.medicalOpenDate" placeholder="请输入开业日期" />
        </el-form-item>
        <el-form-item label="批准文号" prop="medicalPassCode">
          <el-input v-model="form.medicalPassCode" placeholder="请输入批准文号" />
        </el-form-item>
        <el-form-item label="统一社会信用代码" prop="medicalUscc">
          <el-input v-model="form.medicalUscc" placeholder="请输入统一社会信用代码" />
        </el-form-item>
        <el-form-item label="状态" prop="medicalBusitype">
          <el-select v-model="form.medicalBusitype" placeholder="请选择状态">
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listNation, getNation, delNation, addNation, updateNation, exportNation } from "@/api/system/nation";

export default {
  name: "Nation",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 国家机构表格数据
      nationList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        registerNumber: null,
        institutionName: null,
        secondName: null,
        region: null,
        check: null,
        nextCheckDate: null,
        lincenseEnd: null,
        medicalLicense: null,
        updateTimes: null,
        busStatus: null,
        minkeMedicalId: null,
        temp: null,
        medicalLevel: null,
        medicalCategory: null,
        medicalRankname: null,
        medicalNaturebusiness: null,
        medicalRelationship: null,
        medicalLegalrepresentative: null,
        medicalChargerepresentative: null,
        medicalLegalIdCard: null,
        medicalChargeIdCard: null,
        medicalLegalAge: null,
        medicalChargeAge: null,
        medicalOwnership: null,
        medicalMoneyregistered: null,
        medicalMoneyfix: null,
        medicalMoneyflow: null,
        medicalServiceObject: null,
        medicalServiceType: null,
        medicalAreabusi: null,
        medicalBedAmout: null,
        medicalToothChair: null,
        medicalAddress: null,
        medicalPostCode: null,
        medicalSpecialtiesCode: null,
        medicalSpecialtiesName: null,
        medicalAreaname: null,
        medicalOrganName: null,
        medicalPassDate: null,
        medicalBeginDate: null,
        medicalEndDate: null,
        medicalAdminunitName: null,
        medicalTelnum: null,
        medicalInternetType: null,
        medicalHospitalType: null,
        medicalPartnerName: null,
        medicalPartnerunitName: null,
        medicalPvbdate: null,
        medicalPvedate: null,
        medicalStreet: null,
        medicalApplyDate: null,
        medicalOpenDate: null,
        medicalPassCode: null,
        medicalUscc: null,
        medicalBusitype: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        registerNumber: [
          { required: true, message: "登记号不能为空", trigger: "blur" }
        ],
        institutionName: [
          { required: true, message: "机构名称不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询国家机构列表 */
    getList() {
      this.loading = true;
      listNation(this.queryParams).then(response => {
        this.nationList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        uniqueCode: null,
        registerNumber: null,
        institutionName: null,
        secondName: null,
        region: null,
        check: null,
        nextCheckDate: null,
        lincenseEnd: null,
        medicalLicense: null,
        updateTimes: null,
        busStatus: 0,
        minkeMedicalId: null,
        temp: null,
        medicalLevel: null,
        medicalCategory: null,
        medicalRankname: null,
        medicalNaturebusiness: null,
        medicalRelationship: null,
        medicalLegalrepresentative: null,
        medicalChargerepresentative: null,
        medicalLegalIdCard: null,
        medicalChargeIdCard: null,
        medicalLegalAge: null,
        medicalChargeAge: null,
        medicalOwnership: null,
        medicalMoneyregistered: null,
        medicalMoneyfix: null,
        medicalMoneyflow: null,
        medicalServiceObject: null,
        medicalServiceType: null,
        medicalAreabusi: null,
        medicalBedAmout: null,
        medicalToothChair: null,
        medicalAddress: null,
        medicalPostCode: null,
        medicalSpecialtiesCode: null,
        medicalSpecialtiesName: null,
        medicalAreaname: null,
        medicalOrganName: null,
        medicalPassDate: null,
        medicalBeginDate: null,
        medicalEndDate: null,
        medicalAdminunitName: null,
        medicalTelnum: null,
        medicalInternetType: null,
        medicalHospitalType: null,
        medicalPartnerName: null,
        medicalPartnerunitName: null,
        medicalPvbdate: null,
        medicalPvedate: null,
        medicalStreet: null,
        medicalApplyDate: null,
        medicalOpenDate: null,
        medicalPassCode: null,
        medicalUscc: null,
        medicalBusitype: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.uniqueCode)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加国家机构";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const uniqueCode = row.uniqueCode || this.ids
      getNation(uniqueCode).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改国家机构";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.uniqueCode != null) {
            updateNation(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addNation(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const uniqueCodes = row.uniqueCode || this.ids;
      this.$modal.confirm('是否确认删除国家机构编号为"' + uniqueCodes + '"的数据项？').then(function() {
        return delNation(uniqueCodes);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$modal.confirm('是否确认导出所有国家机构数据项？').then(() => {
        this.exportLoading = true;
        return exportNation(queryParams);
      }).then(response => {
        this.$download.name(response.msg);
        this.exportLoading = false;
      }).catch(() => {});
    }
  }
};
</script>
